package trading.algo;

import java.util.TimerTask;

import trading.bo.EmailAccessorBO;
import trading.bo.IBAccessorBO;

public class OptionLmtOrderTask extends TimerTask {

    private IBAccessorBO ibAccessorBO;
    private EmailAccessorBO emailAccessorBO;
    private String action;
    private int size;
    private String orderType;
    private String ticker;
    private double lmtPrice;
    private String expiry;
    private double strike;
    private String right;

    public OptionLmtOrderTask(IBAccessorBO ibAccessorBO,
            EmailAccessorBO emailAccessorBO, String action, int size,
            String orderType, String ticker, double lmtPrice, String expiry,
            double strike, String right) {
        this.ibAccessorBO = ibAccessorBO;
        this.emailAccessorBO = emailAccessorBO;
        this.action = action;
        this.size = size;
        this.orderType = orderType;
        this.ticker = ticker;
        this.lmtPrice = lmtPrice;
        this.expiry = expiry;
        this.strike = strike;
        this.right = right;
    }

    @Override
    public void run() {
        this.ibAccessorBO.createLmtOptionOrder(action, size, orderType, ticker,
                lmtPrice, expiry, strike, right);
        this.emailAccessorBO.sendNewOptionOrderEmail(action, ticker, orderType,
                size + "", expiry, strike + "", right);
    }

}
